package org.hxyjs.dao.impl;

import org.hxyjs.dao.ParticipationrecordDao;
import org.hxyjs.entity.Participationrecord;
import org.hxyjs.mapper.ParticipationrecordMapper;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

@Repository("participationrecordDao")//一般实现类不会直接生成默认对象名 而是使用 接口的默认对象名
public class ParticipationrecordDaoImpl implements ParticipationrecordDao {
    @Resource //autowired 会装配能够直接扫描到的对象  resource spring容器运行的时候才找到需要的对象  注入
    private ParticipationrecordMapper participationrecordMapper;
    public List<Participationrecord>  getAllParticipationrecords() throws Exception{
        return participationrecordMapper.selectByExample(null);
    }

    @Override
    public Integer deleteParticipationrecordByPprno(String pprno)  throws Exception{
        return participationrecordMapper.deleteByPrimaryKey(pprno);
    }

    @Override
    public Integer updateParticipationrecordByPprno(Participationrecord participationrecord)  throws Exception{
        return participationrecordMapper.updateByPrimaryKey(participationrecord);
    }

    @Override
    public Integer addParticipationrecord(Participationrecord participationrecord)  throws Exception{
        return participationrecordMapper.insertSelective(participationrecord);
    }

}
